<?php

declare(strict_types=1);

namespace App\Index\Logic;

use App\ChannelCode\Model\QxmChannelCode;
use App\Corp\Service\CorpService;
use Matrix\Exception;
use Base\Constants\ErrorCode;
use Base\Exception\CommonException;

/**
 *
 * Class IndexLogic
 */
class IndexLogic
{
    /**
     * @var CorpService
     */
    private $corpService;

    /**
     * 企业id.
     * @var int
     */
    private $corpId;

    public function __construct(CorpService $corpService)
    {
        $this->corpService = $corpService;
    }

    /**
     * @return array
     */
    public function getOne()
    {
        try {
            $data = $this->corpService->getCorpById(1);
        }catch (\Exception $e){
            throw new CommonException(ErrorCode::INVALID_PARAMS, '请先选择企业');
        }
        return $data ?? [];
    }


}
